<?php

namespace app\common\lib;

use think\response\Json;

class Show
{

    /**
     * @param array $data
     * @param string $message
     * @param int $httpStatus
     * @return Json
     */
    public static function success(array $data = [],string $message = "OK",int $httpStatus = 200): Json
    {
        $result = [
            "status" => 1,
            "message" => $message,
            "data" => $data,
        ];
        return json($result, $httpStatus);
    }

    /**
     * @param array $data
     * @param string $message
     * @param int $status
     * @param int $httpStatus
     * @return Json
     */
    public static function error(array $data = [],string $message = "error",int $status = 0,int $httpStatus = 200): Json
    {
        $result = [
            "status" => $status,
            "message" => $message,
            "data" => $data,
        ];
        return json($result, $httpStatus);
    }
}